<!DOCTYPE html>
<meta charset=utf-8>
<title>Syntax Highlighting</title>
<link href="../themes/css/blackboard.css" rel="stylesheet" type="text/css" media="screen">
<body>

<pre>
<code data-language="python">#!/usr/bin/env python
# Copyright 2012 Craig Campbell
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re, os, math
from util import Util
from instrument import Instrument

class WarpWhistle(object):
    TEMPO = 'tempo'
    VOLUME = 'volume'
    TIMBRE = 'timbre'
    ARPEGGIO = 'arpeggio'
    INSTRUMENT = 'instrument'
    PITCH = 'pitch'
    OCTAVE = 'octave'
    SLIDE = 'slide'
    Q = 'q'

    ABSOLUTE_NOTES = 'X-ABSOLUTE-NOTES'
    TRANSPOSE = 'X-TRANSPOSE'
    COUNTER = 'X-COUNTER'
    X_TEMPO = 'X-TEMPO'
    SMOOTH = 'X-SMOOTH'
    N106 = 'EX-NAMCO106'
    FDS = 'EX-DISKFM'
    VRC6 = 'EX-VRC6'
    PITCH_CORRECTION = 'PITCH-CORRECTION'

    CHIP_N106 = 'N106'
    CHIP_FDS = 'FDS'
    CHIP_VRC6 = 'VRC6'

    def __init__(self, content, logger, options):
        self.first_run = True

        # current voice we are processing if we are processing voices separately
        self.process_voice = None

        # list of voices to process
        self.voices_to_process = None

        # list of voices
        self.voices = None

        self.content = content
        self.logger = logger
        self.options = options
        self.reset()

    def reset(self):
        """
        This method resets the properties of the instance.
        """
        self.current_voices = []
        self.global_vars = {}
        self.vars = {}
        self.instruments = {}
        self.data = {}
        self.global_lines = []

    def getDataForVoice(self, voice, key):
        if not voice in self.data:
            return None

        if not key in self.data[voice]:
            return None

        return self.data[voice][key]</code>
</pre>

    <script src="../dist/rainbow.js"></script>
    <script src="../src/language/generic.js"></script>
    <script src="../src/language/python.js"></script>
</body>
